<html>
<head><meta charset="utf-8"><title>cargo fix testcase · t-compiler/wg-diagnostics · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/index.html">t-compiler/wg-diagnostics</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/cargo.20fix.20testcase.html">cargo fix testcase</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="232340061"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/cargo%20fix%20testcase/near/232340061" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/cargo.20fix.20testcase.html#232340061">(Mar 29 2021 at 21:34)</a>:</h4>
<p>I'm adding a machine applicable suggestion to rustc that works with cargo fix, what is the best way to add test cases for it?</p>



<a name="232340637"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/cargo%20fix%20testcase/near/232340637" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/cargo.20fix.20testcase.html#232340637">(Mar 29 2021 at 21:39)</a>:</h4>
<p>Also is there a way to rustfmt after cargo fix?</p>



<a name="232340828"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/cargo%20fix%20testcase/near/232340828" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/cargo.20fix.20testcase.html#232340828">(Mar 29 2021 at 21:41)</a>:</h4>
<p>eg: It would be nice if rustfmt can handle how the added braces actually should be aligned</p>



<a name="232340846"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/cargo%20fix%20testcase/near/232340846" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/cargo.20fix.20testcase.html#232340846">(Mar 29 2021 at 21:41)</a>:</h4>
<p><a href="/user_uploads/4715/yCiayeWz3u6DGM1TNjSglzRp/image.png">image.png</a> <br>
<a href="/user_uploads/4715/d9WxDDOenOswtz0pafM0PWOz/image.png">image.png</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/yCiayeWz3u6DGM1TNjSglzRp/image.png" title="image.png"><img src="/user_uploads/4715/yCiayeWz3u6DGM1TNjSglzRp/image.png"></a></div><div class="message_inline_image"><a href="/user_uploads/4715/d9WxDDOenOswtz0pafM0PWOz/image.png" title="image.png"><img src="/user_uploads/4715/d9WxDDOenOswtz0pafM0PWOz/image.png"></a></div>



<a name="232341118"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/cargo%20fix%20testcase/near/232341118" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yuki Okushi <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/cargo.20fix.20testcase.html#232341118">(Mar 29 2021 at 21:43)</a>:</h4>
<p><span class="user-mention silent" data-user-id="281950">Aman Arora</span> <a href="#narrow/stream/147480-t-compiler.2Fwg-diagnostics/topic/cargo.20fix.20testcase/near/232340061">said</a>:</p>
<blockquote>
<p>I'm adding a machine applicable suggestion to rustc that works with cargo fix, what is the best way to add test cases for it?</p>
</blockquote>
<p>Use the <code>// run-rustfix</code> annotation</p>



<a name="232341471"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/cargo%20fix%20testcase/near/232341471" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yuki Okushi <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/cargo.20fix.20testcase.html#232341471">(Mar 29 2021 at 21:46)</a>:</h4>
<p><span class="user-mention silent" data-user-id="281950">Aman Arora</span> <a href="#narrow/stream/147480-t-compiler.2Fwg-diagnostics/topic/cargo.20fix.20testcase/near/232340637">said</a>:</p>
<blockquote>
<p>Also is there a way to rustfmt after cargo fix?</p>
</blockquote>
<p>AFAIK there's no way but I think it's fine that the formatting is poor a bit if it isn't broken</p>



<a name="232342273"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/cargo%20fix%20testcase/near/232342273" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/cargo.20fix.20testcase.html#232342273">(Mar 29 2021 at 21:53)</a>:</h4>
<p>thank you <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span></p>



<a name="232346664"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/cargo%20fix%20testcase/near/232346664" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/cargo.20fix.20testcase.html#232346664">(Mar 29 2021 at 22:39)</a>:</h4>
<p>is there a way to build the fixed file and check it doesn't have errors?</p>



<a name="232357241"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/cargo%20fix%20testcase/near/232357241" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/cargo.20fix.20testcase.html#232357241">(Mar 30 2021 at 00:44)</a>:</h4>
<p><code>// run-rustfix</code> will compile the fixed file automatically (it runs the compiler twice, once to get the suggestions, and then again to verify they work after being applied).</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>